package org.kjtc.exception;

import org.kjtc.web.JsonResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;


/**此注解用于标识此类为全局的异常处理类*/
@ControllerAdvice
public class ControllerExceptionHandler {
	@ExceptionHandler(Exception.class)
	@ResponseBody
	public JsonResult handleException(Exception e){
		e.printStackTrace();
		return new JsonResult(e);
	}	
	@ExceptionHandler(RuntimeException.class)
	@ResponseBody
	public JsonResult handleException(RuntimeException e){
		e.printStackTrace();
		return new JsonResult(e);
	}
}








